Skip to content

fix(segments): warn before discarding an unsaved feature-specific seg…#7840

Open
narendraio wants to merge 1 commit into
Flagsmith:mainfrom
narendraio:fix/5368-warn-unsaved-segment-drawer
Open

fix(segments): warn before discarding an unsaved feature-specific seg…#7840
narendraio wants to merge 1 commit into
Flagsmith:mainfrom
narendraio:fix/5368-warn-unsaved-segment-drawer

Conversation

@narendraio

Copy link
Copy Markdown

Description (replace the blank template with this):

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #5368

When creating a feature-specific segment from the feature panel, the segment is
built in an inline drawer that is closed via the onCancel prop. That path
bypasses the modal's intercept-close handler, so closing the drawer silently
discarded any unsaved work.

This routes the drawer's cancel action through the existing onClosing guard,
so the user is asked to confirm before their unsaved changes are discarded —
the same confirmation already used when closing the full segment modal.

How did you test this code?

Manually:

  1. Open a feature, go to the Segment Overrides tab and click to create a new
    feature-specific segment.
  2. Enter a name / add a rule, then click Cancel on the drawer.
  3. Confirm a "Discard changes" prompt now appears; choosing Cancel keeps the
    drawer open, choosing Ok discards and closes it.
  4. Confirm that closing the drawer with no changes still closes immediately
    (no prompt).

Also ran npm run typecheck and eslint on the changed file (no new errors).

…ment

When creating a feature-specific segment from the feature panel, the segment
is built in an inline drawer that is closed via the `onCancel` prop. That path
bypasses the modal's intercept-close handler, so closing the drawer silently
discarded any unsaved work.

Route the drawer's cancel action through the existing `onClosing` guard so the
user is asked to confirm before their unsaved changes are discarded.

Closes Flagsmith#5368
@narendraio narendraio requested a review from a team as a code owner June 19, 2026 18:02
@narendraio narendraio requested review from talissoncosta and removed request for a team June 19, 2026 18:02
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

@narendraio is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show a warning when closing the drawer after creating a not saved feature-specific segment

2 participants